package monster.flight.admin.action.xtgl.dict;

import monster.comm.action.BaseJsonAction;
import monster.comm.log.ILog;
import monster.comm.log.LogService;
import monster.comm.util.ReturnConstant;
import monster.flight.admin.manager.service.xtgl.DictService;
import monster.flight.comm.entity.vo.Xt_dict;

/**
 * 
* 创建信息=============
* 类名: monster.flight.admin.action.xtgl.dict.DictFindByKeyAction
* 类作用描述: 根据主键dict_sn查询一条数据字典记录
* 创建人： zhongjianjun
* 创建时间： 2013-1-25 上午11:25:17
* 修改信息1=============
* 修改类型:     //1.修改bug 2.业务变化修改
* 修改描述: 
* 修改人：  
* 修改时间：
 */
public class DictInitAction extends BaseJsonAction{
	 private static final long serialVersionUID = 1L;
	 private static ILog log = LogService.getLog(DictInitAction.class);
	 private DictService dictService;
	 private Xt_dict dict;     //字典项

	 public Xt_dict getDict() {
		return dict;
	}
	public void setDict(Xt_dict dict) {
		this.dict = dict;
	}
	
	public void setDictService(DictService dictService) {
		this.dictService = dictService;
	}

	/**
	 * 根据dict_code查询数据字典
	 */
	public String find(){
		String islogin = this.isLogin();
		if("0".equals(islogin)){
			returnVO.returnCode=ReturnConstant.IS_NOT_LOGIN;
	    	returnVO.returnDesc="没有登录";
		 }
		 if("1".equals(islogin)){
			 try {
				 dict = dictService.getPoByKey(dict.getDict_sn());
				 returnVO.returnCode=ReturnConstant.IS_DEAL_OK;
				 returnVO.returnDesc="操作成功";
			} catch (Exception e) {
				returnVO.returnCode=ReturnConstant.IS_ERR;
        		returnVO.returnDesc="查询数据字典项失败!";
        		log.error(e.getMessage());
			}
		 }
		 return "success";
	}
}
